package com.cos.lession79.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author: COS
 * @time: 2022/10/12 11:08
 * @description:
 */
@Configuration
public class MyBatisPlusConfig {
    /**
     *
     * @author: COS
     * @return:
     * @time: 2022/10/12 11:09
     * @description:
     * 配置mybatis插件
     */
    @Bean
    public MybatisPlusInterceptor getMybatisPlusInterceptor(){
        MybatisPlusInterceptor m = new MybatisPlusInterceptor();
        //配置乐观锁插件
        m.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        //配置分页插件
//        m.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return m;
    }

}
